package com.zyz.C_数组;

import java.util.Arrays;

/**
 * @author: vick
 * @Date: 2025/3/13
 * @Description:
 * @version: 1.0
 */
public class Demo5 {
    public static void main(String[] args) {
        int[] nums = {5, 3, 8, 1, 2};

        //复制数组
        int[] copyNums = new int[nums.length];
        System.arraycopy(nums,0, copyNums, 0, nums.length);

        //数组排序 从小到大
        Arrays.sort(nums);

        //合并数组
        int[] arr1 = {1, 2, 3};
        int[] arr2 = {4, 5, 6};
        int[] mergedArr = new int[arr1.length + arr2.length];
        System.arraycopy(arr1, 0, mergedArr, 0, arr1.length);
        System.arraycopy(arr2, 0, mergedArr, arr1.length, arr2.length);



        System.out.println("原数组：" + Arrays.toString(nums));
        System.out.println("复制数组：" + Arrays.toString(copyNums));
        System.out.println("合并数组：" + Arrays.toString(mergedArr));
    }
}
